package com.changzhi.controller;

import com.changzhi.common.annotation.Verify;
import com.changzhi.common.util.Result;
import com.changzhi.ldyl.model.dto.BaseDto;
import com.changzhi.ldyl.model.dto.LanternDto;
import com.changzhi.service.GoddessService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:女神争夺战
 * @author: 小落
 * @date: 2021年02月25日
 */
@Slf4j
@RestController
@RequestMapping("goddess")
public class GoddessController {

	@Autowired
	private GoddessService goddessService;

	@Verify(login = false)
	@PostMapping("rankings")
	public Result rankings(){
		return Result.success(goddessService.rankings());
	}

	@Verify
	@PostMapping("userInfo")
	public Result userInfo(@RequestBody @Validated BaseDto baseDto){
		return Result.success(goddessService.userInfo(baseDto.getUserId()));
	}

	@Verify
	@PostMapping("receiveAward")
	public Result receiveAward(@RequestBody @Validated LanternDto lanternDto){
		return Result.success(goddessService.receiveAward(lanternDto.getUserId(), lanternDto.getType()));
	}
}
